home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / Canvas Loops / FirstCanvas.h < prev    next >
Text File  |  2000-06-23  |  886b  |  44 lines

  1. // FirstCanvas.h
  2.  
  3. #ifndef FirstCanvas_h
  4. #define FirstCanvas_h
  5.  
  6. #ifndef ValidCanvasLoop_h
  7. #include "ValidCanvasLoop.h"
  8. #endif
  9.  
  10. /*
  11.     This is an adapter for code like TextEdit
  12.     or the Control Manager that doesn't expect
  13.     multiple canvases.
  14.     
  15.     On construction, It sets up the first valid
  16.     canvas for the view, or if there is none, a canvas
  17.     in the NoPort.
  18.     
  19.     On destruction, it invalidates all remaining canvases
  20.     of the view -- thus inefficiently causing the results
  21.     of any operation performed in between to be echoed.
  22. */
  23.  
  24. class FirstCanvas
  25.   {
  26.     private:
  27.         ValidCanvasLoop validCanvas;
  28.  
  29.         FirstCanvas( const FirstCanvas& );
  30.         void operator=( const FirstCanvas& );
  31.     
  32.     public:
  33.         FirstCanvas( const DrawsSpontaneously& view )
  34.           : validCanvas( view )
  35.           {}
  36.         
  37.         ~FirstCanvas();
  38.         
  39.         const Canvas& operator*() const;
  40.         const Canvas *operator->() const        { return &operator*(); }
  41.   };
  42.  
  43. #endif
  44.